import * as crypto from 'crypto';

/**
 * 生成一个唯一的ID，默认是8位
 * @returns 唯一的UUID字符串
 */
export function generateRandomString(length: number = 8): string {
    const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
    let result = '';
    for (let i = 0; i < length; i++) {
        result += characters.charAt(Math.floor(Math.random() * characters.length));
    }
    return result;
}